Page({
  data: {
    isLike: true,
    // banner
    indicatorDots: true, //是否显示面板指示点
    autoplay: true, //是否自动切换
    interval: 3000, //自动切换时间间隔,3s
    duration: 1000,//	滑动动画时长1s
    imgUrls: [
     'https://img10.360buyimg.com/n1/s450x450_jfs/t1/225845/27/18067/69755/66432b1aF8492a7ae/6859a50cea2153fe.jpg.avif',
     'https://img10.360buyimg.com/n1/s450x450_jfs/t1/74315/19/21651/49472/62fef8ceE2775cee4/e354884e00a37b27.jpg.avif',
     'https://img10.360buyimg.com/n1/s450x450_jfs/t1/88309/37/7563/47272/5dfccdc1Ed1cbc094/1188797cd58e8c9d.jpg.avif',
     'https://img14.360buyimg.com/n1/jfs/t1/159899/28/42954/94783/65f17f32F9c1c761a/468de072057d5a11.jpg.avif',
     'https://img10.360buyimg.com/n1/s450x450_jfs/t1/88336/26/7631/95098/5dfccdc2E98d5df83/053a0bdd05d5b2ff.jpg.avif'
    ],


    // 商品详情介绍
    detailImg: [
      "https://img10.360buyimg.com/imgzone/jfs/t1/236254/19/10605/162155/6598d3deF6a72da37/99773c6a230853df.jpg",
      "https://img10.360buyimg.com/imgzone/jfs/t1/233077/22/11220/74771/6598d3ddF47f1cb5a/526012bf1513a320.jpg ",     
      "https://img10.360buyimg.com/imgzone/jfs/t1/235275/28/10924/246069/6598d3ddFb04d1213/6245bc1a2865cc02.jpg",
      "https://img10.360buyimg.com/imgzone/jfs/t1/235717/5/10151/108290/6598d3dcFb83c252b/72dfa2b7e3e3e623.jpg",
      "https://img10.360buyimg.com/imgzone/jfs/t1/229375/23/10839/141999/6598d3dcF45bbe25c/61aa369ef863af32.jpg",
      "https://img10.360buyimg.com/imgzone/jfs/t1/246004/3/2207/159608/6598d3dcFb20f9c8e/99dbfb2edb136063.jpg",
    ],
  },
  //预览图片
  onLoad() {
    console.log(this.data.imgUrls); // 检查数据是否正常
  },
  previewImage(e) {
    wx.previewImage({
      current: e.currentTarget.dataset.src,
      urls: this.data.imgUrls

    })
  },
  // 收藏
  addLike() {
    this.setData({
      isLike: !this.data.isLike
    });
  },
  // 跳到购物车
  toCar() {
    wx.switchTab({
      url: '/pages/cart/cart'
    })
  },
  // 立即购买
  immeBuy() {
    wx.showToast({
      title: '购买成功',
      icon: 'success',
      duration: 2000
    });
  },
})